Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Implement ITextProvider and ITextRangeProvider for UIA - #38538

Merged
yaakovschectman merged 17 commits into
flutter-team-archive:mainfrom
yaakovschectman:uiatext_0
Jan 3, 2023
Merged

Implement ITextProvider and ITextRangeProvider for UIA#38538
yaakovschectman merged 17 commits into
flutter-team-archive:mainfrom
yaakovschectman:uiatext_0

Conversation

@yaakovschectman

Copy link
Copy Markdown
Contributor

This is the initial subset of #38284, handling importing files from Chromium, making modifications necessary to compile, and temporarily disabling the newly added unittests.

In order for text providing nodes to properly interact with screen reader commands via UIA, we need to implement text and textedit pattern providers. As an example, this allows screen readers to narrate the character after the carat when the user moves the carat in an edit field with the arrow keys.

Unit tests for AXPlatformNodeText(Range)ProviderWin are modeled after those found in the Chromium source. Details for some required modification to account for differences between the two codebases, and a handful of the newly introduced test cases are currently disabled, which is tracked in flutter/flutter#117012.

Functionality for searching for text in a text range does not yet respect the ignore_case option: flutter/flutter#117013.

Part of flutter/flutter#116219

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

Comment thread third_party/accessibility/ax/ax_node.h
Comment thread third_party/accessibility/ax/ax_node.h
auto current_line_start = start->Clone();
while (!current_line_start->IsNullPosition() && *current_line_start < *end) {
auto current_line_end = current_line_start->CreateNextLineEndPosition(
AXBoundaryBehavior::CrossBoundary);

@loic-sharma loic-sharma Dec 28, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to this conversation: #38284 (comment)

@loic-sharma: Could you explain why AXBoundaryDetection::kDontCheckInitialPosition was removed here?

@yaakovschectman:
The method signature for our version of CreateNextLineEndPosition takes a parameter of a different type than Chrome's current version of the same. We take a AXBoundaryBehavior, while Chromium takes a struct consisting of AXBoundaryBehavior, AXBoundaryDetection

Why are our method signatures different? Should we update our signatures to match Chromium's? Will we get behavioral differences if we don't update (either here or in other places that use CreateNextLineEndPosition with a non-default AXBoundaryDetection)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not only a superficial signature difference, our implementation is different also. We do not have the AXMovementOptions struct that exists in Chromium. Updating it in our existing code may warrant a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. What are the resulting behavior differences while we don't have AXMovementOptions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably, there will not be an inherent difference between checking or not checking the initial position when moving by a boundary. I think for our purposes a similar effect can be achieved by the conditions used where the enclosing methods are called.

size_t* find_length,
bool ignore_case,
bool backwards) {
// TODO(schectman) Respect ignore_case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to add internationalization support?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I do not know what actual use case calls this method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of updating the issue/comment to mention both internalization and case insensitivity?

case TextUnit_Character:
new_position =
MoveEndpointByCharacter(position_to_move, count, units_moved);
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was TextUnit_Format removed? Should there be a TODO?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I will see if it can be added

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. We do not actually have kFormatStart and kFormatEnd in our TextBoundary enum.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread third_party/accessibility/ax/platform/ax_platform_node_textrangeprovider_win.cc Outdated
@loic-sharma

Copy link
Copy Markdown
Contributor

The code changes seem good, nice work! Could you detail your test plan once text providers are completed? Will it be manual validation using a screen reader? If so, what scenarios will you test?

@yaakovschectman

Copy link
Copy Markdown
Contributor Author

@loic-sharma In particular, hovering the cursor over an element, moving the focus using the keyboard, and triggering a read of the current element (e.g. NVDA+Up). Once TextProviders are fully implemented, this will also include moving the carat, erasing characters, and changing the selection using the keyboard.

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo pending comments. Nice work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

2 participants